{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "46a40530-dbe0-4109-923d-ee9691f416bb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      " -\n",
      " abc\n",
      " 8\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "--abc---\n"
     ]
    }
   ],
   "source": [
    "a = input()  # 请输入填充符号\n",
    "c = input()  # 请输入要显示的字符串\n",
    "flag = 1\n",
    "while flag:\n",
    "   try:\n",
    "       b = int(input()) # 请输入字符串总长度\n",
    "   except:\n",
    "       flag = 1\n",
    "       print(\"请输入一个正整数\")\n",
    "   else:\n",
    "       if type(b)== int and b>0:\n",
    "            flag = 0 \n",
    "       else:\n",
    "            flag = 1\n",
    "            print(\"请输入一个正整数\")\n",
    "print('{0:{1}^{2}}'.format(c,a,b))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b5770dad-993e-40a7-9a4a-501f31c386f3",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
